Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TE with threading build #1092

Merged
merged 9 commits into from
Aug 12, 2024
Merged

TE with threading build #1092

merged 9 commits into from
Aug 12, 2024

Conversation

phu0ngng
Copy link
Collaborator

@phu0ngng phu0ngng commented Aug 9, 2024

Description

In #987, TE build with parallel jobs was added, while threading for fused_attn build was removed. With #1048, the build time of the ext can be measured and compared.
It turns out that using max parallel jobs together with setting --threads 4 halves the build time. However, it adds some potential oversubscribes that may break the build on NGC. So NVTE_BUILD_THREADS_PER_JOB env var was added to provide an option to disable this threading build.

By default, NVTE_BUILD_THREADS_PER_JOB=1 to avoid potential build issues on small systems.
Users are encouraged to play with the NVTE_BUILD_THREADS_PER_JOB value based on their system.

NVTE_MAX_BUILD_JOBS was renamed to NVTE_BUILD_MAX_JOBS for consistency.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refractor

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: Phuong Nguyen <[email protected]>
transformer_engine/common/CMakeLists.txt Outdated Show resolved Hide resolved
transformer_engine/common/CMakeLists.txt Outdated Show resolved Hide resolved
@phu0ngng
Copy link
Collaborator Author

I updated the default value for threading to 1 and added a message for parallel build info.

phu0ngng and others added 4 commits August 10, 2024 07:57
Co-authored-by: Tim Moon <[email protected]>
Signed-off-by: Phuong Nguyen <[email protected]>
Signed-off-by: Phuong Nguyen <[email protected]>
Signed-off-by: Phuong Nguyen <[email protected]>
Copy link
Collaborator

@timmoon10 timmoon10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -68,7 +68,7 @@ def setup_pytorch_extension(
print("Could not determine CUDA Toolkit version")
else:
if version >= (11, 2):
nvcc_flags.extend(["--threads", "4"])
nvcc_flags.extend(["--threads", os.getenv("NVTE_BUILD_THREADS_PER_JOB", "1")])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phu0ngng could you document here the reason for switching from 4 to 1 as a default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @timmoon10 mentioned, users getting stuck in the build process (#976, #978, #1077).
Besides, the PyTorch Ext build with --thread 4 broke on my desktop. I discussed with Tim and we think it is better to have 1 as default so that all users have fewer build issues.
For "advanced" users, they are encouraged to play with NVTE_BUILD_THREADS_PER_JOB to best match their system.

Copy link
Member

@ksivaman ksivaman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@phu0ngng phu0ngng merged commit ed3fb6b into NVIDIA:main Aug 12, 2024
13 of 14 checks passed
@phu0ngng phu0ngng deleted the build_threads branch August 12, 2024 22:31
mgoldfarb-nvidia pushed a commit to mgoldfarb-nvidia/TransformerEngine that referenced this pull request Aug 14, 2024
* added threading build back

* integrating threading for pytorch and paddle extensions

* added messages

---------

Signed-off-by: Phuong Nguyen <[email protected]>
Co-authored-by: Tim Moon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants